package result

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type Context struct {
	*gin.Context
}

type Result struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func Success(message string, data interface{}) *Result {
	return &Result{
		Code:    http.StatusOK,
		Data:    data,
		Message: message,
	}
}

func Fail(ErrorCode int, message string) *Result {
	return &Result{
		Code:    ErrorCode,
		Data:    nil,
		Message: message,
	}
}
